//
//  SetHvacModeApi.m
//  AFNetworking
//
//  Created by Henry on 2023/3/8.
//

#import "SetHvacModeApi.h"
@interface SetHvacModeApi()

@property(nonatomic,assign)BOOL isHot;
@property(nonatomic,assign)BOOL isCool;
@property(nonatomic,assign)BOOL isFan;
@property(nonatomic,assign)BOOL isECO;
@end
@implementation SetHvacModeApi

-(id)initWithDevId:(NSString *)thingName withHotMode:(BOOL)isHot withCoolMode:(BOOL)isCool withFanMode:(BOOL)isFan withECO:(BOOL)isECO{
    if(self = [super init]){
        self.thingName = thingName;
        self.isHot = isHot;
        self.isCool = isCool;
        self.isFan = isFan;
        self.isECO = isECO;
    }
    return self;
}


-(id)getTopic{
    return [NSString stringWithFormat:@"/command/platform/%@",self.thingName];
}

-(id)getCommandContent{
    
    int cool = self.isCool?0x01:0x00;
    int hot = self.isHot?0x02:0x00;
    int fan = self.isFan?0x04:0x00;
    int eco = self.isECO?0x08:0x00;
    int ade = cool|hot|fan|eco;
    
    return @{@"command":@"SetThermostatMode",@"param":@{@"value":@(ade)}};
}

-(id)getSubcribeTopic{
    return [NSString stringWithFormat:@"$aws/things/%@/shadow/name/%@/update/accepted",self.thingName,self.thingTypeName];
}
@end
